package com.jd.system.result;

public enum ResponseStatues {

    EXCEPTION(0,"异常"),
    SUCCESS(200, "成功"),
    FAIL(999, "失败"),


    SEL_ERROR1(501, "当天没有有效配置，无法计算妥投时间！"),

    DATE_ERROR(511,"时间格式错误！"),
    ;

    private Integer code;
    private String message;

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }


    ResponseStatues(int code, String message) {
        this.code = code;
        this.message = message;
    }

    // 根据ID获取MESSAGE
    public static String getMessageByCode(Integer code) {
        for (ResponseStatues ele: values()) {
            if(ele.getCode().equals(code)) {
                return ele.getMessage();
            }
        }
        return null;
    }
}
